import dayjs from 'dayjs'  

function toWei(value) {
  if(!window.web || value == undefined) return
  return window.web.web3.utils.toWei(value.toString(), 'ether')
}

function fromWei(value) {
  if(!window.web || value == undefined) return
  return window.web.web3.utils.fromWei(value, 'ether')
}

function convertDate(value) {
  return dayjs(value * 1000).format("YYYY/MM/DD")
}

export {
  toWei,
  fromWei,
  convertDate
}